<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="kaiji">
    <meta name="keyword" content="权限, 角色, 博客, 信息, 列表">
    <title>角色的权限信息列表</title>
	<#include "admin/common.ftl" />
	<style type="text/css">
	 #roleTable tr td:first-child {cursor: pointer;}
	</style>
  </head>

  <body>

  	<section id="container" class="">
    	  <!--header start-->
      <#include "admin/header.ftl" />
      <!--header end-->
      <!--sidebar start-->
      <#include "admin/sidebar.ftl" />
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
      	<section class="wrapper">
      	  <div class="row">
      	    <div class="col-lg-12">
              <section class="panel">
                <header class="panel-heading">设置权限</header>
                <div class="panel-body">
                  <form id="editForm" action="${ctx}/admin/role/jurisdiction.html" method="POST" onsubmit="return check();">
                    <input name="roleId" value="${roleId}" type="hidden"/>
	    				<table class="table" id="roleTable">
				      <thead>
				        <th>菜单</th>
				        <th>按钮</th>
				      </thead>
				      <#list jurisdictionList as jurisdiction>
				      <tr>
				        <td title="点击全选" class="all">${(jurisdiction.name)!}</td>
				        <td>
				         <input type="checkbox" name="ids" 
				        		<#list myJurisdictionList as myJurisd>
				        			<#if myJurisd.jurisdictionId == jurisdiction.jurisdictionId >
				        				checked = "true"
				        			</#if>
				        		</#list>
				          value="${(jurisdiction.jurisdictionId)!}" /> ${(jurisdiction.name)!}
				        <#list jurisdiction.childs as child>
				        <input type="checkbox" name="ids" 
				        		<#list myJurisdictionList as myJurisd>
				        			<#if myJurisd.jurisdictionId == child.jurisdictionId >
				        				checked = "true"
				        			</#if>
				        		</#list>
				          value="${(child.jurisdictionId)!}" /> ${(child.name)!}
				        </#list>
				        </td>
				      </tr>
				      </#list>
				    	<table>
				    	<div class="form-group">
				    	  <div class="col-sm-2 col-sm-offset-2">
				    	    <button class="btn" type="submit">提交</button>
				    	  </div>
				    	</div>	  
				  </form>
                </div>
              </section>
            </div>
      	  </div>
      	</section>
      	
	  </section>
	</section>
<#include "admin/common_js.ftl" />
<script src="${ctx}/js/jquery.validate.min.js" ></script>
<script type="text/javascript">
$(function(){
  function check() {
  	var $ids = $('input:checkbox:checked').val();
    if (null == $ids || undefined == $ids || $ids.length <= 0) {
      layer.alert(data.message, {icon: 5});
      return false;
    }
    return true;
  }
});
</script>
  </body>
</html>